﻿package {
	import flash.display.*;
	import flash.events.*;
	import flash.external.ExternalInterface;
	
	public class Jate1 extends MovieClip {
		private var editor:Editor;
		
		public function Jate1():void {
			//舞台不缩放，左上角对齐并禁用右键菜单
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			stage.showDefaultContextMenu = false;
			//editor
			editor = new Editor();
			addChild(editor);
			//ei
			initEI();
		}
		
		public function initEI():void {
			if (ExternalInterface.available) {
				ExternalInterface.addCallback("init", init);
				ExternalInterface.addCallback("resize", resize);
				ExternalInterface.call("jate.exec");
			}
		}
		
		private function init(w:int, h:int):void {
			editor.initPos(w, h);
		}
		private function resize(w:int, h:int):void {
			editor.resize(w, h);
		}
	}
}